<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>商品管理</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="../../../component/elementUI/index.css">
    <link rel="stylesheet" href="../../../style/wangeditor.css">
    <link rel="stylesheet" href="../../../style/index.css">
    <style>
        .custom-tree-node {
            flex: 1;
            display: flex;
            align-items: center;
            justify-content: space-between;
            font-size: 14px;
            padding-right: 8px;
        }

        .custom-tree-node .config {
            padding: 10px 0 10px 8px;
            /* border-left: 1px solid #EBEEF5; */
        }

        .el-tree-node__content {
            padding: 10px 0 10px;
            /* border-bottom: 1px solid #EBEEF5; */
        }

        .el-dialog__header {
            padding: 15px 15px 10px;
        }

        .el-dialog__body {
            padding: 15px;
        }

        .el-dialog__footer {
            padding: 5px 15px 10px;
        }

        .cont-scroll-wrap {
            border: 1px solid #EBEEF5;
            flex: auto;
            height: 0;
            /* overflow-y: auto; */
            position: relative;
        }
        .image-slot{
            width: 100%;
            height: 100%;
        }
    </style>
</head>

<body>
    <div id="app" v-cloak class="minWidth">
        <el-form :inline="true" :form="form">
            <el-form-item>
                <el-input v-model.trim="form.Article_Name" clearable placeholder="请输入商品名称"/>
            </el-form-item>
            <el-form-item>
                <el-select v-model.trim="form.selectScreen" style="width: 100%;" clearable placeholder="筛选价格">
                    <el-option v-for="(item,index) in screen" :key="index" :label="item.label" :value="item.value"></el-option>
                </el-select>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="onSerach">查询</el-button>
            </el-form-item>
            <el-form-item>
                <yl-button type="success" :data="ExportData" :loading="loading" @click="Export(form)">供应商品导出</yl-button>
            </el-form-item>
            <!-- <el-form-item>
                <el-dropdown trigger="click" @command="handleBatchAdd">
                    <el-button type="primary">
                        批量上/下架<i class="el-icon-arrow-down el-icon--right"></i>
                    </el-button>
                    <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item command="1">批量上架</el-dropdown-item>
                        <el-dropdown-item command="0">批量下架</el-dropdown-item>
                    </el-dropdown-menu>
                </el-dropdown>
            </el-form-item> -->
            <el-form-item>
                <el-dropdown trigger="click" @command="downloadTemplate">
                    <el-button type="primary">
                        下载导入模板<i class="el-icon-arrow-down el-icon--right"></i>
                    </el-button>
                    <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item command="Article">经营商品模板</el-dropdown-item>
                    </el-dropdown-menu>
                </el-dropdown>
            </el-form-item>
            <el-form-item>
                <el-dropdown trigger="click" @command="importTemplate">
                    <el-button type="danger">
                        批量导入<i class="el-icon-arrow-down el-icon--right"></i>
                    </el-button>
                    <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item command="Article">导入供应商经营商品</el-dropdown-item>
                    </el-dropdown-menu>
                </el-dropdown>
            </el-form-item>
        </el-form>
        <el-row :gutter="20">
            <el-col :span="isTree?5:0">
                <div :style="{height:'calc(100vh - 140px)'}" class="cont-scroll-wrap">
                    <el-tree highlight-current @node-click="handleNode" :data="treeData" node-key="TreeNode" default-expand-all
                        :expand-on-click-node="false" :props="defaultProps">
                        <span class="custom-tree-node" slot-scope="{ node, data }">
                            <span>
                                <i :class="node.level == 1 ? 'el-icon-user' : 'el-icon-star-off'"></i>
                                <span>{{ node.label }}</span>
                            </span>
                        </span>
                    </el-tree>    
                </div>
            </el-col>
            <el-col style="position: relative;" :span="isTree?19:24">
                <div @click="showTree" style="cursor: pointer; text-align: center; color:#606266; font-size: 12px; border: 1px solid #EBEEF5; position: absolute; left: -11px; top: 0px; width: 15px;">
                    {{isTree?'隐藏树状图←':'显示树状图→'}} 
                </div>
                <el-table :data="tableData" stripe border height="calc(100vh - 140px)" style="width: 100%" @selection-change="handleSelectionChange">
                    <el-table-column align="center" type="selection" width="40"></el-table-column>
                    <el-table-column align="center" type="index" label="序号" width="50"></el-table-column>
                    <el-table-column align="center" prop="Supplier_Article_SerialNumber" show-overflow-tooltip  width="140" label="供应商品编号"></el-table-column>
                    <el-table-column align="center" prop="Picture_URL" width="140" align="center" label="商品封面">
                        <template v-slot="{row}">
                            <el-image fit="contain" :preview-src-list="[BASE_IMG + row.Picture_URL1]" :src="BASE_IMG + row.Picture_URL1" style="width:100px;height: 100px;border-radius: 5px;">
                                <div slot="error" class="image-slot">
                                    <el-image fit="contain" :preview-src-list="[BASE_IMG + row.Picture_URL]" :src="BASE_IMG + row.Picture_URL" style="width:100px;height: 100px;border-radius: 5px;">
                                </div>                            
                            </el-image>
                        </template>
                    </el-table-column>
                    <el-table-column align="center" prop="Article_Name" width="140" show-overflow-tooltip label="商品名称"></el-table-column>
                    <el-table-column align="center" prop="Specifications_Name" width="140" show-overflow-tooltip label="规格名称"></el-table-column>
                    <el-table-column align="center" prop="Supplier_Name" width="140"  show-overflow-tooltip label="供应商"></el-table-column>
                    <el-table-column align="center" prop="Brand_Name"  width="100" show-overflow-tooltip label="品牌"></el-table-column>
                    <el-table-column align="center" prop="Group" width="120" label="是否参与团购"></el-table-column>
                    <el-table-column align="center" prop="Sales_Unit_Price" width="110" show-overflow-tooltip label="今日销售单价"></el-table-column>
                    <el-table-column align="center" prop="Purchase_Unit_Price" width="110" show-overflow-tooltip label="今日采购单价"></el-table-column>
                    <el-table-column align="center" prop="JDCOM_URL" width="100"  label="京东链接"></el-table-column>
                    <el-table-column align="center" prop="JDCOM_Unit_Price" width="100"  label="京东价"></el-table-column>
                    <el-table-column align="center" prop="Total_stock" label="今日库存"></el-table-column>
                    <el-table-column align="center" prop="Stock_Remain" label="剩余库存"></el-table-column>
                    <el-table-column align="center" prop="Stock_Sell" label="已售"></el-table-column>
                    <!-- <el-table-column align="center" prop="Shelf" label="状态">
                        <template v-slot="{row}">
                            <el-tag :type="row.Shelf=='0'?'success':'danger'">{{row.Shelf=='0'?'已上架':'未上架'}}</el-tag> 
                        </template>
                    </el-table-column>                                                                                                                                      -->
                    <!-- <el-table-column align="center" label="操作" width="90">
                        <template v-slot="{row}">
                            <el-button :type="row.Shelf=='0'?'danger':'success'" size="small" @click="Remove(row)">{{row.Shelf=='0'?'下架':'上架'}}</el-button>
                        </template>
                    </el-table-column> -->
                </el-table>
                <el-pagination style="margin-top: 5px;" background @size-change="handleSizeChange"
                    @current-change="handleCurrentChange" :current-page="form.page" :page-sizes="[10, 20, 30, 50]"
                    :page-size="form.limit" layout="total, sizes, prev, pager, next, jumper" :total="total">
                </el-pagination>
            </el-col>   
        </el-row>        
    </div>
    <script type="text/javascript" src="../../../utils/wangeditor.js"></script>
    <script type="text/javascript" src="../../../utils/jquery.min.js"></script>
    <script type="text/javascript" src="../../../utils/jquery.cookie.js"></script>
    <script type="text/javascript" src="../../../utils/vue.min.js"></script>
    <script type="text/javascript" src="../../../utils/vuex.min.js"></script>
    <script type="text/javascript" src="../../../component/elementUI/index.js"></script>
    <script type="text/javascript" src="../../../component/component.js"></script>
    <script type="text/javascript" src="../../../utils/FileSaver.min.js"></script>
    <script type="text/javascript" src="../../../utils/FileSaver.js"></script>
    <script type="text/javascript" src="../../../utils/xlsx.full.min.js"></script>
    <script type="text/javascript" src="../../../utils/xlsx.core.min.js"></script>
    <script type="text/javascript" src="../../../config/config.js"></script>
    <script type="text/javascript" src="../../../utils/compressor.js"></script>
    <script type="text/javascript" src="../../../utils/ID_Validity.js"></script>
    <script type="text/javascript" src="../../../utils/utils.js"></script>
    <script type="text/javascript" src="js/index.js"></script>
</body>

</html>